<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="d" uri="http://dgg.net/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>资质库容预警明细</title>
    <%@ include file="../../../header.jsp" %>
</head>
<body class="body-main">
<form id="searchInfo">
    <div class="titleSearch">
        <d:hasUrlAuth authCode="ZZSC_ZS_SYB">
            <div class="layui-inline">
                <label>所属事业部：</label>
                <div class="layui-input-inline">
                    <select name="signOrgId" id="signOrgId" class="input-style" autocomplete="off">
                        <option value="">全部</option>
                    </select>
                </div>
            </div>
        </d:hasUrlAuth>

        <div class="layui-inline">
            <label>资质类型：</label>
            <div class="layui-input-inline">
                <select class="select-style" name="certificateType" id="certificateType"
                        onchange="loadCertificateType('190px','#certificateType','${generalType}',1,'#certificateSpecialty',1)">
                    <option value="">请选择</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label>资质名称：</label>
            <div class="layui-input-inline">
                <select class="select-style" name="certificateSpecialtys" id="certificateSpecialty">
                    <option value="">请选择</option>
                </select>
            </div>
        </div>
        <div class="layui-inline">
            <label>资质等级：</label>
            <div class="layui-input-inline">
                <select class="select-style" name="certificateLevel" id="certificateLevel">
                    <option value="">请选择</option>
                    <c:forEach items="${certificateLevels}" var="level">
                        <option value="${level.code}">${level.name}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

        <div class="layui-inline">
            <label>地区：</label>
            <div class="layui-input-inline">
                <div class="bus-plugIn" id="certificateArea">
                    <input type="hidden" name="certificateAreaId" class="plug-in-msg"/>
                    <input type="hidden" name="certificateArea" class="plug-in-code"/>
                    <input type="text" readonly placeholder="请选择" class="chose-plugIn layui-input" id="certificateAreaChange" name="areaName">
                    <div class="bus-picker">
                        <div class="bus-picker-tab">
                            <a href="javascript:void(0);" class="active">请选择</a>
                        </div>
                        <div class="bus-picker-content"></div>
                    </div>
                </div>
            </div>
        </div>

        <div class="layui-inline">
            <label>适用范围：</label>
            <div class="layui-input-inline">
                <select class="select-style" name="applicationScopes">
                    <option value="">全部</option>
                    <c:forEach var="p" items="${applicationScopes}">
                        <option value="${p.code}">${p.name}</option>
                    </c:forEach>
                </select>
            </div>
        </div>

        <div class="layui-inline">
            <input type="hidden" name="generalType" value="${generalType}"/>
            <button class="layui-btn layui-btn-mini layui-btn-normal" onclick="search('#myTable','reload')" type="button">搜索</button>
            <button class="layui-btn layui-btn-mini layui-btn-primary" onclick="cleanSearch()" type="button">清空</button>
        </div>
    </div>
</form>

<d:hasUrlAuth authCode="ZZSC_ZS_PT_GLY">
    <div class="table-conter">
        <a href="javascript:void(0)" class="layui-btn layui-btn-mini" onclick="setZZWarning()">库容预警设置</a>
    </div>
</d:hasUrlAuth>

<table id="myTable" class="cell-border crm-table">
</table>

<%@ include file="../../../footer.jsp" %>
<script src="${pageContext.request.contextPath}/static/js/zzsc/common/functionalTool.js"></script>
<script src="${pageContext.request.contextPath}/static/js/zzsc/credential/generalCertificate/stotageCapacity.js"></script>
<script src="${pageContext.request.contextPath}/static/js/zzsc/credential/credentailCommon/credentailCommon.js" type="text/javascript" charset="utf-8"></script>
<script>
    $(function () {
        // 加载事业部
        syb('[name="signOrgId"]');
        loadCertificateType('190px','#certificateType', '${generalType}', 0);
        //异步加载
        Plug.plug_ins(
            "get",
            "${cmsBaseUrl}/api/cms/tree_book/v1/get_tree_book_list.do?code=2147483647&type=2&level=1",
            "#certificateArea",
            '请选择地区',
            function () {
            },
            true, '2147483647'
        );

        $('#myTable').dataTableExtend({
            "ajax": {
                "url": "${rootUrl}/zs/credential/stotage_capacity/get_stotage_capacity.do",
                "type": "post"
            }, "fnServerParams": function (aoData) {
                var checkResult = checkHasSybAuth($('#signOrgId option'));
                aoData = $.extend(aoData, $("#searchInfo").serializeObject());
                if (!checkResult) {
                    aoData = $.extend(aoData, {"isAll": "0"});
                }
            },
            "pageLength": 20,//每页显示的条数默认是10条，有特殊业务需要显示不同条数的列表才应该加入该参数
            "scrollX": true,//是否开启横项滚动
            "fixedColumns": {//锁定列，只有开启scrollX时才生效
                "leftColumns": 3,//左侧锁定2列
                "rightColumns": 2//右侧锁定1列
            },
            "aoColumns": [{
                "title": "序号",
                "render": function (data, type, full, meta) {
                    return meta.row + 1;
                },
                "orderable": false
            },
                {
                    "title": "所属事业部",
                    "data": "signOrgName",
                    "orderable": false
                },
                {
                    "title": "资质类型",
                    "data": "certificateTypeName",
                    "orderable": false
                },
                // {
                //     "title": "资质名称",
                //     "data": "certificateMajorName",
                //     "orderable": false
                // },
                {
                    "title": "资质等级",
                    "data": "certificateLevel",
                    "orderable": false
                },
                {
                    "title": "地区",
                    "data": "provinceArea",
                    "orderable": false
                },
                {
                    "title": "适用范围",
                    "data": "applicationScope",
                    "orderable": false
                },
                {
                    "title": "在库可用量",
                    "data": "libraryNumbers",
                    "orderable": false,
                    "render": function (data, type, row, meta) {
                        return "<a href='javascript:void(0);'  class='layui-table-link' onclick='goToAptitudeList(\"" + row.certificateCode + "\")'>" + data + "</a>";
                    }
                },
                {
                    "title": "预订量",
                    "data": "reserveNumbers",
                    "orderable": false,
                    "render": function (data, type, row, meta) {
                        return "<a href='javascript:void(0);'  class='layui-table-link' onclick='goToAptitudeList(\"" + row.certificateCode + "\")'>" + data + "</a>";
                    }
                },
                {
                    "title": "匹配量",
                    "data": "matchNumbers",
                    "orderable": false,
                    "render": function (data, type, row, meta) {
                        return "<a href='javascript:void(0);'  class='layui-table-link' onclick='goToAptitudeList(\"" + row.certificateCode + "\")'>" + data + "</a>";
                    }
                },
                {
                    "title": "预约量",
                    "data": "orderNumbers",
                    "orderable": false
                }]
        });
    });

    function goToAptitudeList(certificateCode) {
        window.parent.updateTab("资质信息列表", sysInfo.basePath + "/zs/credential/qualification/index.html?certificateCode=" + certificateCode);
    }

</script>
</body>
</html>
